﻿#define _CRT_SECURE_NO_WARNINGS 1

// 1.经此一役小红所向无敌
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;

int a, b, h, k;

signed main()
{
    cin >> a >> h >> b >> k;

    int sum = 0;
    int cnt1 = h / b;
    int cnt2 = k / a;
    if (h % b)
        cnt1++;
    if (k % a)
        cnt2++;

    int cnt = min(cnt1, cnt2);
    sum += cnt * (a + b);
    if (cnt1 > cnt2)
        sum += a * 10;
    if (cnt2 > cnt1)
        sum += b * 10;

    cout << sum << endl;
    return 0;
}

// 2.连续子数组最大和
#include <iostream>
#include <algorithm>
using namespace std;

const int N = 2e5 + 10;
int n;
int arr[N];
int dp[N][2];
int main() {
    cin >> n;

    for (int i = 1; i <= n; ++i)
        cin >> arr[i];

    for (int i = 1; i <= n; ++i)
    {
        dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]);
        dp[i][1] = max(dp[i - 1][1] + arr[i], arr[i]);
    }

    int flag = 1;
    for (int i = 1; i <= n; ++i)
        if (arr[i] >= 0) flag = 0;
    if (!flag)
        cout << max(dp[n][0], dp[n][1]) << endl;
    if (flag)
    {
        sort(arr + 1, arr + n + 1);
        cout << arr[n] << endl;
    }
    return 0;
}

// 3.⾮对称之美
#include <iostream>
#include <string>
using namespace std;
int n;
string s;
int fun()
{
    // 1. 判断是否全都是相同字符
    bool flag = false;
    for (int i = 1; i < n; i++)
    {
        if (s[i] != s[0])
        {
            flag = true;
            break;
        }
    }
    if (flag == false) return 0;

    // 2. 判断本⾝是否是回⽂
    flag = true;
    int left = 0, right = n - 1;
    while (left < right)
    {
        if (s[left] == s[right])
        {
            left++;
            right--;
        }
        else
        {
            flag = false;
            break;
        }
    }

    if (flag) 
        return n - 1;
    else 
        return n;
}

int main()
{
    cin >> s;
    n = s.size();

    cout << fun() << endl;

    return 0;
}